home *** CD-ROM | disk | FTP | other *** search
- /****h* $ProjectFileName [$ProjectVersion] ****************
- *
- * NAME
- * $ProjectFileName
- *
- * DESCRIPTION
- *
- * SYNOPSIS
- * $ProjectName is a GUI for....
- *
- * HISTORY
- * $DateToday - Created this file.
- *
- * COPYRIGHT
- * $ProjectFileName $DateToday(C) by $ProjectAuthorName
- *
- * NOTES
- *
- * $VER: $ProjectFileName $ProjectVersion ($DateToday) by $ProjectAuthorName
- ************************************************************************
- *
- */
-
- #include <stdio.h>
- #include <string.h>
-
- #include <exec/types.h>
-
- #include <AmigaDOSErrs.h>
-
- #include <intuition/intuition.h>
- #include <intuition/classes.h>
- #include <intuition/classusr.h>
- #include <intuition/imageclass.h> // for Image Buttons only
- #include <intuition/gadgetclass.h>
-
- #include <libraries/gadtools.h>
-
- $ProgramOptionDefines
-
- #ifdef $IconSupport
- # include <workbench/workbench.h>
- # include <workbench/startup.h>
- # include <workbench/icon.h>
- #endif
-
- #ifdef $ASLSupport
- # include <utility/tagitem.h>
- # include <dos/dostags.h>
- # include <libraries/asl.h>
- #endif
-
- #include <graphics/displayinfo.h>
- #include <graphics/gfxbase.h>
-
- $IncludePragmas
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/utility_protos.h>
- #include <clib/diskfont_protos.h>
-
- #include <proto/locale.h>
-
- struct Catalog *catalog = NULL;
-
- #define CATCOMP_ARRAY 1
- $LocaleHeader
-
- #define MY_LANGUAGE "english"
-
- $IncludeCommonFuncs
-
- $GadgetIDs
-
- // ----------------------------------------------------
-
- #ifdef $ImageSupport
- IMPORT Class *initGet( void ); // in Boopsi.o
-
- struct IClass *getClass = NULL;
- struct _Object *getImage = NULL;
- #endif
-
- #ifdef $IconSupport
-
- IMPORT struct WBStartup *_WBenchMsg;
- PRIVATE struct DiskObject *diskobj = NULL;
-
- struct Library *IconBase;
-
- #endif
-
- // ----------------------------------------------------
-
- struct IntuitionBase *IntuitionBase;
- struct GfxBase *GfxBase;
- struct Library *GadToolsBase;
- struct LocaleBase *LocaleBase;
-
- // ----------------------------------------------------
-
- PRIVATE char v[] = "\0$VER: $ProjectFileName $ProjectVersion " __AMIGADATE__ " by $ProjectAuthorName \0";
-
- $GUIVariables
-
- $MXStrings
- $CycleStrings
- $ListViewStrings
-
- PRIVATE struct TextAttr $ScreenFontName$ScreenFontSize = { "$ScreenFontName.font", $ScreenFontSize, 0x00, 0x62 };
-
- // TTTTTTTTT $ProjectFileName ToolTypes: TTTTTTTTT
-
- #ifdef $IconSupport
-
- PRIVATE char Tool1[32] = "TOOL1";
-
- PRIVATE char DefTool1[128] = "";
-
- PRIVATE char *TTTool1 = &DefTool1[0];
-
- #endif
-
- // TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
-
- #ifdef $ASLSupport
-
- PRIVATE struct TagItem FileTags[] = {
-
- ASLFR_Window, (ULONG) NULL,
- ASLFR_TitleText, (ULONG) "Obtain a filename...",
- ASLFR_InitialHeight, 400,
- ASLFR_InitialWidth, 500,
- ASLFR_InitialTopEdge, 16,
- ASLFR_InitialLeftEdge, 100,
- ASLFR_PositiveText, (ULONG) " OKAY! ",
- ASLFR_NegativeText, (ULONG) " CANCEL! ",
- ASLFR_InitialPattern, (ULONG) "#?",
- ASLFR_InitialFile, (ULONG) "",
- ASLFR_InitialDrawer, (ULONG) "RAM:",
- ASLFR_Flags1, FRF_DOPATTERNS,
- ASLFR_Flags2, FRF_REJECTICONS,
- ASLFR_SleepWindow, 1,
- ASLFR_PrivateIDCMP, 1,
- TAG_END
- };
-
- #endif
-
- $MenuFunctionNames
- $MenuArray
-
- $IntuiTextArray
-
- $GadgetTypesArray
- $GadgetFunctionNames
- $GadgetsArray
- $GadgetTagsArray
-
- // ----------------------------------------------------
-
- PRIVATE UBYTE em[512], *ErrMsg = &em[0];
-
- /****i* CMsg() [$ProjectVersion] *************************************************
- *
- * NAME
- * STRPTR rval = CMsg( int index, char *defaultStr );
- *
- * DESCRIPTION
- * Obtain a string from the locale catalog file, failing that,
- * return the default string.
- **********************************************************************
- *
- */
-
- PRIVATE STRPTR CMsg( int strIndex, char *defaultString )
- {
- if (catalog != NULL)
- return( (STRPTR) GetCatalogStr( catalog, strIndex, defaultString ) );
- else
- return( (STRPTR) defaultString );
- }
-
- /****i* SetupCatalog() [$ProjectVersion] *****************************************
- *
- * NAME
- * SetupCatalog()
- *
- * DESCRIPTION
- **********************************************************************
- *
- */
-
- PRIVATE void SetupCatalog( void )
- {
- $LocaleStrings
- return;
- }
-
- // ----------------------------------------------------------------
-
- $SetupScreenCode
- $CloseScreenCode
- $CloseWindowCode
-
- // ----------------------------------------------------------------
-
- $MenuFunctions
- $GadgetFunctions
-
- // ----------------------------------------------------------------
-
- $BevelBoxRenderFunction
- $IntuiTextRenderFunction
- $OpenWindowDefn
- $IDCMPHandlers
- $IDCMPCode
-
- // ----------------------------------------------------------------
-
- PRIVATE void ShutdownProgram( void )
- {
- $CloseGUI
- if (catalog != NULL)
- CloseCatalog( catalog );
-
- if (LocaleBase != NULL)
- CloseLibrary( (struct Library *) LocaleBase );
-
- # ifdef $IconSupport
- if (IconBase != NULL)
- CloseLibrary( (struct Library *) IconBase );
- # endif
-
- CloseLibs();
-
- return;
- }
-
- PRIVATE int SetupProgram( void )
- {
- int rval = RETURN_OK;
-
- if (OpenLibs() < 0)
- {
- rval = ERROR_INVALID_RESIDENT_LIBRARY;
-
- goto exitSetup;
- }
-
- # ifdef $IconSupport
- if ((IconBase = OpenLibrary( "icon.library", 37L )) == NULL)
- {
- fprintf( stderr, CMsg( MSG_FMT_LIB_UNOPENED, MSG_FMT_LIB_UNOPENED_STR ),
- "icon.library", "37"
- );
-
- ShutdownProgram();
-
- rval = ERROR_INVALID_RESIDENT_LIBRARY;
-
- goto exitSetup;
- }
- # endif
-
- if ((LocaleBase = OpenLibrary( "locale.library", 37L )) == NULL)
- {
- fprintf( stderr, CMsg( MSG_FMT_LIB_UNOPENED, MSG_FMT_LIB_UNOPENED_STR ),
- "locale.library", "37"
- );
-
- ShutdownProgram();
-
- rval = ERROR_INVALID_RESIDENT_LIBRARY;
-
- goto exitSetup;
- }
-
- catalog = OpenCatalog( NULL, "$CatalogName",
- OC_BuiltInLanguage, MY_LANGUAGE,
- TAG_DONE
- );
-
- (void) SetupCatalog();
-
- $OpenGUI
- exitSetup:
-
- return( rval );
- }
-
- #ifdef $IconSupport
- PRIVATE void *processToolTypes( char **toolptr )
- {
- if (toolptr == NULL)
- return( NULL );
-
- // Place your tool grabbers here:
-
- return( NULL );
- }
- #endif
-
- PUBLIC int main( int argc, char **argv )
- {
- # ifdef $IconSupport
- struct WBArg *wbarg;
- char **toolptr = NULL;
- # endif
-
- int error = RETURN_OK;
-
- if ((error = SetupProgram()) != RETURN_OK)
- {
- return( error );
- }
-
- # ifdef $IconSupport
- if (argc > 0) // from CLI:
- {
- // We prefer to use the ToolTypes:
- (void) FindIcon( &processToolTypes, diskobj, argv[0] );
- }
- else // from Workbench:
- {
- wbarg = &(_WBenchMsg->sm_ArgList[ _WBenchMsg->sm_NumArgs - 1 ]);
- toolptr = FindTools( diskobj, wbarg->wa_Name, wbarg->wa_Lock );
-
- processToolTypes( toolptr );
- }
- # endif
-
- $MainSettings
-
- # ifdef $IconSupport
- FreeDiskObject( diskobj );
- # endif
-
- ShutdownProgram();
-
- return( RETURN_OK );
- }
-
- /* --------------- END of $ProjectFileName file! ------------------ */
-